package com.xyhuo.leetcode.december;

import java.util.ArrayList;
import java.util.List;

/**
 * 不浪费原料的汉堡制作方案
 * https://leetcode.cn/problems/number-of-burgers-with-no-waste-of-ingredients/
 *
 * @time 2023/12/25
 */
public class NumOfBurgers {

    public List<Integer> numOfBurgers(int tomatoSlices, int cheeseSlices) {
        List<Integer> ans = new ArrayList<>();
        int tmp = 4 * cheeseSlices - tomatoSlices;
        if (tmp >= 0 && tmp % 2 == 0) {
            int y = tmp / 2;
            int x = cheeseSlices - y;
            if (x >= 0 && y >= 0) {
                ans.add(x);
                ans.add(y);
            }
        }
        return ans;
    }
}
